import java.util.*;

public class TreeNode {
    
    public int val;
    public TreeNode left;
    public TreeNode right;

    public TreeNode(int val){

        this.val = val;
    }

    public String toString(){

        StringJoiner stringJoiner = new StringJoiner(", ");
        TreeNode cur = this;
        if(null!=this){

            Queue<TreeNode> queue = new LinkedList<>();

            queue.add(cur);

            while (!queue.isEmpty()) {
            

                TreeNode temp = queue.poll();

                stringJoiner.add(temp.val+"");

                if(null!=temp.left) queue.add(temp.left);
                if(null!=temp.right) queue.add(temp.right);


            }
        }

        return stringJoiner.toString();

    }
}
